/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/fake_statusbar_w_menubar.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */

/* Creates a statusbar by using menubar */
/* Since it's really the menubar this won't work if you also want the menubar on top of the screen */

/* The setup requires few things:
1. Put the preferences button to the LEFT of the menubar items
2. Put a single toolbarspring next to the menubar items on RIGHT side
3. Move your "statusbar" - buttons to menubar
4. Make menubar permanently DISABLED
 */

/* Themes that use background images will not show properly with this style */

@-moz-document url("chrome://browser/content/browser.xhtml"){
  
  /* Uncomment the next block to hide the settings button from the fake statusbar */
  /*
  #toolbar-menubar > #preferences-button{
    margin-inline-end: -30px !important; 
    visibility: visible;
  }*/
  
  #toolbar-menubar{
    background-color: var(--lwt-accent-color,var(--toolbox-bgcolor)) !important;
    position: fixed;
    min-height: 1px !important;
    height: unset !important;
    bottom: 0;
    width: 100vw;
    padding-top: 1px;
  }
  #toolbar-menubar > :is(spacer,.titlebar-buttonbox-container){
    display: none !important;
  }

  #toolbar-menubar > .toolbarbutton-1:first-child:not(:hover) + #menubar-items:not(:hover){ visibility: collapse }

  #toolbar-menubar > .titlebar-buttonbox-container + toolbarspring{
    background-position: left 5px;
    background-repeat: no-repeat;
    background-image: -moz-element(#statuspanel);
    max-width: none !important;
    flex-grow: 1;
  }
  /* Using -moz-element() causes some problems after Firefox has been running several hours such as long tab switch times. For this reason the background image is removed on hover and focused states which appears to clear the state. */
  #toolbar-menubar > .titlebar-buttonbox-container + toolbarspring{ background-image: -moz-element(#statuspanel) }
  #toolbar-menubar:hover > .titlebar-buttonbox-container + toolbarspring{ background-image: none }
  

  #statuspanel-label{
    height:3em;
    min-width: 1000px;
    background-color: var(--lwt-accent-color, hsla(0,0%,100%,.8)) !important;
    border: none !important;
    font-size: inherit;
    color: inherit !important;
    margin-inline: 0 !important;
  }
  /* If you use a theme where urlbar is partially transparent you should edit this color to something that closely matches the perceived color of urlbar. Or perhaps use background-image - linear-gradient() can work well here. But keep the color or image opaque or otherwise you'll face an issue where urlbar text bleeds through */
  #statuspanel-inner{ background-color: var(--toolbar-accent-color) }
  /*#statuspanel-inner{ background-color: var(--toolbar-non-lwt-bgcolor) }*/

  #statuspanel{
    color: lightpink;
    z-index: -1 !important;
    inset-inline: 0 auto !important;
    padding-top: 0 !important;
  }
  #statuspanel[type="status"] { color: skyblue }

  #statuspanel-inner{ margin-left: -3px; margin-top: 1px}
  #statuspanel-label[value^="https"]{ color: var(--toolbar-field-color, black) !important;}

  #customization-container,
  #content-deck,
  #browser{ margin-bottom: var(--tab-min-height) }

  :root[inDOMFullscreen] :is(#customization-container,#content-deck,#browser),
  :root[inFullscreen] :is(#customization-container,#content-deck,#browser){
    margin-bottom: 0px;
  }
  
  /* These should make sure that there is some opaque color covering the real statuspanel - necessary when RFP letterboxing is enabled */
  .browserContainer,
  .browserSidebarContainer{
    background-color: inherit;
  }
  @media -moz-pref("userchrome.fake_statusbar_w_menubar-tabs_below_content.compat.enabled"){
    #toolbar-menubar{
      grid-row: 11/12;
      background-attachment: scroll;
      position: static
    }
    #customization-container,
    #content-deck,
    #browser{ margin-bottom: revert }
  }
}